#!/bin/bash

outfile=merged.pdf

for file in $*
do
    echo converting to pdf: $file
    convert $file $file.pdf
    pdf+=" $file.pdf"
done

#echo all pdf $pdf
echo merging files to $outfile
pdfmerge $pdf $outfile

echo cleaning up
rm $pdf
